package com.project.grenting.controller;

import com.project.grenting.pojo.Order;
import com.project.grenting.service.order.OrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/order")
public class OrderController {
    @Resource
    private OrderService orderService;


    @RequestMapping("/orderList")
    @RequiresPermissions("orderList")
    public String orderList(Model model) {

        List<Order> orderList = orderService.getAllOrders();
        model.addAttribute("orderList", orderList);

        return "order/orderList";
    }


}

    /*  @PostMapping("/doUserEdit")
    @RequiresPermissions("userEdit")
    public String doOerEdit(Order order, int[] roles, Model model) {

        //暂不实现，记住原则，修改用户之前，需将用户角色中间表根据用户id删除，然后重新分配角色

        return "user/userList" ;
    }*/


  /*  @GetMapping("/orderEdit")
    @RequiresPermissions("orderEdit")
    public String orderEdit(@PathVariable("id") int id, Model model) {
        Order orderList = orderService.getOrderById(id) ;
        model.addAttribute("orderList", orderList) ;
        return "order/orderEdit" ;
    }*/

/*
  @GetMapping("/userEdit/{uid}")
    @RequiresPermissions("userEdit")
    public String userEdit(@PathVariable("uid") int uid, Model model) {
        User user = userService.getUserById(uid) ;
        model.addAttribute("user", user) ;

        List<Role> roleList = roleService.getAllRoles() ;
        model.addAttribute("roleList", roleList) ;

        return "user/userEdit" ;
    }


 @PostMapping("/doUserEdit")
    @RequiresPermissions("userEdit")
    public String doUerEdit(User user, int[] roles, Model model) {

        //暂不实现，记住原则，修改用户之前，需将用户角色中间表根据用户id删除，然后重新分配角色

        return "user/userList" ;
    }*/







